package com.stockz.equity.charting.event.listener;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JScrollBar;

import org.springframework.stereotype.Component;

import com.stockz.equity.charting.event.EventPublisher;
import com.stockz.equity.charting.event.RepaintStockChartPanelEvent;

@Component
public class ScrollListener extends MouseAdapter {
	@Override
	public void mouseDragged(MouseEvent e) {
		EventPublisher.publishEvent(new RepaintStockChartPanelEvent(((JScrollBar)e.getSource()).getParent()));
	}
	@Override
	public void mouseReleased(MouseEvent e) {
		EventPublisher.publishEvent(new RepaintStockChartPanelEvent(((JScrollBar)e.getSource()).getParent()));
	}
}
